package feiyanren.com;

public class A03_Demo3 {
    public static void main(String[] args) {
        int[] arr = {1,3,2,4,5,6,7,8,9,10};
        int[] arr_sort = Sort(arr);
        for(int i=0;i<arr_sort.length;i++){
            System.out.println(arr_sort[i]);
        }
    }

    public static int[] Sort(int[] arr){
        int StartIndex = -1;
        for(int i=0;i<arr.length;i++){
            if(arr[i] > arr[i + 1]){
                StartIndex = i + 1;
                break;
            }
        }
        int j = StartIndex;
        while(j > 0 && arr[j] < arr[j - 1]){
            int temp = arr[j];
            arr[j] = arr[j - 1];
            arr[j - 1] = temp;
            j--;
        }
        return arr;
    }
}
